<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>添加管理员-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../static/css/font.css">
		<link rel="stylesheet" href="../../static/css/weadmin.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
      <script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
  </head>
  
  <body>
    <div class="weadmin-body">
        <form class="layui-form">
          <div class="layui-form-item">
              <label for="name" class="layui-form-label">
                  <span class="we-red">*</span>社团名
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="name" name="name" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>

          </div>
          <div class="layui-form-item">
              <label for="create_date" class="layui-form-label">
                  <span class="we-red">*</span>创建日期
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="create_date" name="create_date" required="required" lay-verify=""
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_email" class="layui-form-label">
                  <span class="we-red">*</span>人数
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="L_email" name="nums" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="we-red">*</span>社团简介
                </label>
                <div class="layui-input-inline">
                    <textarea name="details" required lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="create_date" class="layui-form-label">
                    社团级别
                </label>
                <div class="layui-input-inline">
                    <select name="level">
                        <option>请选择分类</option>
                        <option value="1">五星社团</option>
                        <option value="2">四星社团</option>
                        <option value="3">三星社团</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="create_date" class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="add" lay-submit="">增加</button>
            </div>

      </form>
    </div>
		<script src="../../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript">
    		layui.extend({
					admin: '{/}../../static/js/admin'
				});
        layui.use(['form','layer','admin','jquery'], function(){
          var form = layui.form,
          	admin = layui.admin,
          	layer = layui.layer;
            var $ = layui.jquery;
          	form.render();
          //监听提交
          form.on('submit(add)', function(data){
            console.log(data);
            var f = data.field;
            var d = {
                  "name":f.name,
                  "createDate":f.create_date,
                  "nums":f.nums,
                  "level":f.level,
                  "details":f.details
              };
            $.ajax({
                type: "post",
                url: '/api/organ/insertOrgan',
                //dataType:'json',
                contentType:'application/json;charset=UTF-8',
                data:JSON.stringify(d),
                //async:false,
                success:function(res) {
                    if(res.code == 0 || res.msg =="成功") {
                        layer.msg("添加成功")
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
              return false;
            });



        });
    </script>
  </body>

</html>